package UDP;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-09-08
 * Time:15:42
 */
public class UdpEchoServer2 extends UdpEchoServer {
    private Map<String,String> dict=new HashMap<>();
    public UdpEchoServer2(int port) throws SocketException {
        super(port);
        dict.put("小猫","cat");
        dict.put("小狗","Dog");
        dict.put("马","horse");
        dict.put("猪","pig");
        dict.put("老虎","tiger");
    }

    @Override
    public String process(String str) {
        return dict.getOrDefault(str,"没有该值");
    }

    public static void main(String[] args) throws IOException {
        UdpEchoServer2 t1=new UdpEchoServer2(9090);
        t1.start();
    }
}
